using System.Linq;

namespace Magiq.Delete {
  public class QueryableDelete<T> : IQueryableDelete<T> where T : class {
    private readonly IDeleteProvider provider;
    private readonly IQueryable<T> @where;

    public QueryableDelete(IQueryable<T> where) {
      provider = Magiq.For(where).GetDeleteProvider();
      this.where = where;
    }

    #region IQueryableDelete<T> Members

    public int Execute() {
      return provider.Execute(this);
    }

    public IQueryable<T> Where {
      get { return where; }
    }

    #endregion
  }
}